-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add parameter_files and parameters configuration options to stack definition #338
Add parameter_files and parameters configuration options to stack definition #338
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one! 👍 with a couple comments for your consideration.
Also, could you update the readme to include info on the new functionality?
@@ -34,6 +35,7 @@ def initialize(attributes = {}) | |||
@additional_parameter_lookup_dirs ||= [] | |||
@template_dir ||= File.join(@base_dir, 'templates') | |||
@allowed_accounts = Array(@allowed_accounts) | |||
@parameters ||= {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use the conditional assignment operator in the initializer? Is @parameters
expected to be set before the initializer is run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The call to super
above sets values from the yaml file, so it would either be set from that point or not, in which case the default is {}
.
file = StackMaster.s3_driver.find_file(bucket: bucket, object_key: key) | ||
parsed_file = JSON.parse(file) | ||
expect(parsed_file).to eq JSON.parse(body) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what this test achieves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It checks the contents match by comparing parsed hashes rather than strings. For some reason apply_with_s3.feature started failing, and master and has the same issue - https://travis-ci.org/github/envato/stack_master/jobs/692383878#L2514 Maybe it's related to a sparkleformation upgrade?
Co-authored-by: Peter Vandoros <[email protected]>
…inition' of github.com:envato/stack_master into add-parameter-files-and-parameters-options-to-stack-definition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff!
I notice that if I specify an explicit parameter file, but don't provide a parameter needed by a template I get the old validation error message:
Parameters will be read from files matching the following globs:
- parameters/stackname.y*ml
- parameters/us-east-1/stackname.y*ml
This'll likely cause confusion given those globs aren't used when explicitly specifying the parameter files. I think we should update this message to include only the defined parameter files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Thanks for this.
Do you think we should also support compile-time parameters in the stack_master.yml
?
I think they would be supported already due to the way
|
Oh I see. I tried it and you're quite right, it does just work! |
Following on from an earlier spike, but without the stack definition moving to its own file for better backwards compatibility. #330.
Added
parameters_dir
configThis matches what we have for
template_dir
and is useful for theparameter_files
feature.parameter_files
- an array of explicit parameter file locations based fromparameter_dir
Adds the ability to explicitly define parameter file locations in stack definitions. It's more obvious this way, and it can also be used to massively reduce duplication between stacks that follow a blue/green setup. For example, if we have
myapp-blue
andmyapp-green
, they could share a parameter file for the majority of parameters, whereas currently that's not possible without duplicating all the parameters.parameters
hash key can add parameters inline with the rest of the stack definitionThis can be useful when switching to a new stack that only needs a small change in parameters: